package com.jinsi.service.ylt;

import com.jinsi.pojo.SyUserCouponUsed;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @ClassName CouponService
 * @Content 优惠券接口
 * @Author 姚龙腾
 * @Date 2022/10/12 10:40
 */
public interface CouponService {


    /**
     * 查询有的优惠券(模糊查询所需的信息)
     * @param discountsName
     * @param discountsType
     * @param discountsQuantity
     * @return List<SyUserCouponUsed>
     */
    List<SyUserCouponUsed> getAll(
            String discountsName,
            String discountsType,
            Integer discountsQuantity);


    /**
     * 添加的优惠券
     * @param coupon
     * @throws Exception
     */
    void addCoupon(SyUserCouponUsed coupon) throws Exception;


    /**
     * 修改上架还是下架
     * @param discountsId
     * @param discountsQuantity
     * @throws Exception
     */
    void upCouponState(
            @Param("discountsId") int discountsId,
            @Param("discountsQuantity") int discountsQuantity) throws Exception;


    /**
     * 优惠券总数量减一
     * @param discountsId
     * @param discountsAmount
     * @return int
     */
    int upCouponNum(int discountsId, int discountsAmount);


    /**
     * 发放优惠券
     * @param userId
     * @param discountsId
     * @return int
     */
    int addUserCoupon(Integer userId,Integer discountsId);
}
